<div id="topic-sidebar" data-spy="affix" data-offset-bottom="65">
  <div class="card">
    <div class="card-body">
      <a href="#" class="btn btn-default btn-block btn-sm btn-move-page" data-type="top"><i class="fa fa-arrow-up"></i></a>
      <div class="buttons">
        <div class="group likes opts">
          <%= likeable_tag(@topic) %>
        </div>
        <div class="group">
          <div class="btn-group" role="group">
            <%= topic_follow_tag(@topic, class: 'btn btn-default') %>
            <%= topic_favorite_tag(@topic, class: 'btn btn-default') %>
          </div>
        </div>
      </div>
      <hr />
      <div class="group">
        <%= social_share_button_tag h("#{@topic.title}") %>
      </div>
      <hr />
      <div class="reply-buttons">
        <div class="total">
          共收到 <b><%= @topic.replies_count %></b> 条回复
        </div>
        <%= reward_user_tag(@topic.user) %>
      </div>
      <hr />
      <div class="group opts">
        <% if admin? %>
          <div style="margin-bottom: 8px">
            <% if !@topic.suggested_at.blank? %>
            <%= link_to raw("<i class='fa fa-angle-double-up'></i> 取消"), unsuggest_admin_topic_path(@topic), method: :post, remote: true %>
            <% else %>
            <%= link_to raw("<i class='fa fa-angle-double-up'></i> 置顶"), suggest_admin_topic_path(@topic), method: :post, remote: true %>
            <% end %>
            <% if !@topic.excellent? %>
            <%= link_to raw("<i class='fa fa-diamond'></i> 加精"), action_topic_path(@topic, type: 'excellent'), method: "post", remote: true %>
            <% end %>

            <% if !@topic.ban? %>
              <%= link_to raw("<i class='fa fa-ban'></i> 屏蔽"), ban_topic_path(@topic), remote: true, title: "全站屏蔽此贴" %>
            <% else %>
              <%= link_to raw("<i class='fa fa-ban'></i> 取消"), action_topic_path(@topic, type: 'normal'), method: :post, remote: true, title: "取消全站屏蔽此贴" %>
            <% end %>
          </div>
        <% end %>

        <% if owner?(@topic) or admin? %>
        <div>
          <% if can?(:close, @topic) %>
            <% if !@topic.closed? %>
              <%= link_to raw("<i class='fa fa-check'></i> 结束"), action_topic_path(@topic, type: 'close'), method: 'post', title: "关闭讨论／问题已解决", remote: true, data: { toggle: 'tooltip' } %>
            <% else %>
              <%= link_to raw("<i class='fa fa-undo'></i> 开启"), action_topic_path(@topic, type: 'open'), method: 'post', title: "重新开启话题", remote: true, data: { toggle: 'tooltip' } %>
            <% end %>
          <% end %>
          <%= link_to raw('<i class="fa fa-pencil"></i> 编辑'), edit_topic_path(@topic), title: "修改本帖" %>
          <% if can?(:destroy, @topic) %>
            <%= link_to raw('<i class="fa fa-trash"></i> 删除'), topic_path(@topic.id), method: :delete, 'data-confirm' => t("common.confirm_delete"), title: "删除本帖", remote: true %>
          <% end %>
        </div>
        <% end %>
      </div>
      <a href="#" class="btn btn-default btn-sm btn-block btn-move-page" data-type="bottom"><i class="fa fa-arrow-down"></i></a>
    </div>
  </div>

  <div class="notify-updated">
    <a class="update" href="#"><i class="fa fa-bell-o"></i> <b>有新回复！</b>点击这里立即载入</a>
  </div>
</div>
